package com.ase.mobile.controller;

import com.ase.mobile.service.NbaPlayerService;
import com.ase.mobile.utils.RedisUtils;
import com.ase.mobile.utils.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName：TestController
 * @Description：Redis控制器
 * @Author：chenyb
 * @Date：2020/8/17 12:07 上午
 * @Versiion：1.0
 */
@RestController
@RequestMapping("/nba")
public class RedisController {
    @Autowired
    private RedisUtils redisUtils;
    @Autowired
    private NbaPlayerService nbaPlayerService;

    @GetMapping("/setAndGet")
    public String test(String k, String v) {
        redisUtils.set(k, v);
        return (String) redisUtils.get(k);
    }

    @GetMapping("/queryNBAPlayerCacheList")
    public Result queryNBAPlayerCacheList() {
        return nbaPlayerService.listNbaPlayer();
    }
}
